package com.ruoyi.framework.websocket;

import javax.websocket.Session;

/**
 * WebSocket用户对象，存储用户信息
 *
 * @author ruoyi
 */
public class WebSocketUser {

    /**
     * WebSocket会话
     */
    private Session session;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 用户名称
     */
    private String userName;

    /**
     * 会话ID
     */
    private String sessionId;

    public WebSocketUser() {
    }

    public WebSocketUser(Session session, Long userId, String userName) {
        this.session = session;
        this.userId = userId;
        this.userName = userName;
        this.sessionId = session.getId();
    }

    public Session getSession() {
        return session;
    }

    public void setSession(Session session) {
        this.session = session;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    @Override
    public String toString() {
        return "WebSocketUser [sessionId=" + sessionId + ", userId=" + userId + ", userName=" + userName + "]";
    }
}
